<?php

class WSB_View_Helper_PageTree
{

	// <script src="../WSB/library/PEAR/HTML/TreeMenu/TreeMenu.js" language="JavaScript" type="text/javascript"></script>

	private $_view;

	public function pageTree($mode = null, $pageId = null)
	{

		$src = '../WSB/library/PEAR/HTML/TreeMenu/TreeMenu.js';
		$this->_view->headScript()->offsetSetFile($src, $src);

		if(empty($pageId)) {
			$front = Zend_Controller_Front::getInstance();
			$request = $front->getRequest();
			$pageId = $request->getParam('page_id');
		}

		$pageId = intval($pageId);

		$mode = intval($mode);
		$dhtmlTree = new WSB_Dhtml_PageTree($mode);
		$dhtmlTree->setPageId($pageId);
		$dhtmlTree->render();
	}

    /**
     * Setze View Objekt. Diese Methode wird beim ersten Instanzieren aufgerufen.
     *
     * @param Zend_View_Interface $view
     */
    public function setView(Zend_View_Interface $view)
    {
        $this->_view = $view;
    }

}
